package org.shilong.UI.welcome;

import org.shilong.UI.R;
import org.shilong.UI.login.LoginFrame;
import org.shilong.Utility.ImagesUtility;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.ImageView;

/**
 * 
 * @author Administrator
 * 欢迎页面
 *
 */
public class WelcomeFrame extends Activity {

	private ImageView imageview_logo;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites()
				.detectNetwork()   // or .detectAll() for all detectable problems
				.penaltyLog()
				.build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedSqlLiteObjects().penaltyLog().penaltyDeath().build());
		super.onCreate(savedInstanceState);

		setContentView( R.layout.layout_logo_content );

		initViews();

		toLoginPage();
	}

	private void initViews(){

		imageview_logo = ( ImageView )this.findViewById( R.id.imageview_logo );


		Bitmap  bitmap = ImagesUtility.getFlectionBitmap( this, R.drawable.welcome_logo );

		imageview_logo.setImageBitmap(bitmap);



	}
	/**
	 * 跳转登陆页面 
	 */
	private void toLoginPage(){

		new Thread(){

			@Override
			public void run() {

				try {
					Thread.sleep( 1500 );
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				System.out.println("开始跳转..");
				startActivity( new Intent( WelcomeFrame.this, LoginFrame.class ) );
				WelcomeFrame.this.finish();
			}


		}.start();
	}


}
